package durose.system.springUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.github.pagehelper.Page;

import durose.system.pojo.Sys_log;

/**
 * 获取分页对象，重新封装
 * 
 * @author Administrator
 *
 */
@Component
public class SpringSys_logFactory {

	public static SpringSys_logFactory me() {
		return SpringContextHolder.getBean("springSys_logFactory");
	}

	// 将List<Boss>格式的数据 改造成List<Map<String,Object>>类型，并在此处初始化一对多
	@SuppressWarnings("all")
	public List<Map<String, Object>> initData(Page page) {
		Page pageNew = page;
		List<Sys_log> lists = pageNew.getResult();
		List<Map> mapList = new ArrayList<>();
		for (Sys_log sys_log : lists) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("log_id", sys_log.getLog_id());
			map.put("log_name", sys_log.getLog_name());
			map.put("log_descri", sys_log.getLog_descri());
			map.put("log_detail", sys_log.getLog_detail());
			map.put("log_date", sys_log.getLog_date());
			mapList.add(map);
		}
		pageNew.clear();
		pageNew.addAll(mapList);
		return pageNew;
	}

}
